#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
using namespace std;

#define LINE_LENGTH 200

int main()
{
    char to_delete[LINE_LENGTH + 1] = {0};
    scanf("%s ", to_delete);
    int delete_len = strlen(to_delete);
    for (int i = 0; i < delete_len; i++)
        if (to_delete[i] > 'Z')
            to_delete[i] -= 32;
    // printf("%s\n", to_delete);

    char input[LINE_LENGTH + 1] = {0};
    while (cin.getline(input, LINE_LENGTH)) {
        int bias = 0;
        int input_len = strlen(input);
        for (int i = 0; i < input_len; i++) {
            int j;
            for (j = 0; j < (int)strlen(to_delete); j++) {
                if (to_delete[j] != input[j+i+bias] && (to_delete[j] + 32) != input[j+i+bias])
                    break;
            }

            if (j == (int)strlen(to_delete))
                bias += j;
            
            if (input[i+bias] == ' ')
                bias++;
            
            input[i] = input[i + bias];
        }
        printf("%s\n", input);
    }
}